import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
import pandas as pd
# 需要提前安装
# pip install pandas
# pip install openpyxl
mpl.rcParams['font.sans-serif']=['SimHei']#让中文可以正常显示
plt.rcParams['axes.unicode_minus']=False #让负号能够正常显示
data8=pd.read_excel('可视化图表.xlsx',sheet_name=8)
print(data8.head())
plt.figure()
plt.fill_between(data8['年份'],0,data8['销售额(万元)'],fc='y',alpha=0.5,label='销售额(万元)')
plt.fill_between(data8['年份'],0,data8['成本'],fc='b',alpha=0.5,label='成本')
plt.legend()
plt.show()
